/*
 * @Descripttion: 自定义指令：权限控制 v-permission
 * @Author: 66
 * @Date: 2020-12-15 15:28:48
 * @LastEditors: 66
 * @LastEditTime: 2020-12-15 15:58:38
 * @1.自定义权限数组
 * @2.判断用户权限是否在数组内，true显示 false移除Dom
 */
const permission = {
  inserted: (el,binding) => {
    let permission = binding.value // 获取到v-perminssion的值
    if(permission) {
      let hasPermission = () => {
        let arr = ['1','2','3','4'] // 定义数组  根据需求获取
        let index = arr.indexOf(permission)
        if(index > -1) {
          return true
        }else {
          el.parentNode&&el.parentNode.removeChild(el)
        }
      }
      hasPermission()
    }
  }
}

export default permission